﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="RaisePurchaseOrder.aspx.cs" Inherits="PresentationLayer.RaisePurchaseOrder" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .auto-style1
        {
            width: 134px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
        <div align="center">
            <h2>Raise Purchase Order</h2>
            <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <asp:Label ID="lblMessage" runat="server" ForeColor="Red"></asp:Label>
                    <asp:ValidationSummary ID="ValidationSummary2" runat="server" DisplayMode="List" ForeColor="Red" ValidationGroup="SubmitGrp" />
                    <asp:ValidationSummary ID="ValidationSummary1" runat="server" DisplayMode="List" ForeColor="Red" ValidationGroup="UpdateGrp" />
                    <br />
                    <table class="table-condensed">
                        <tr align="left">
                            <td class="auto-style1">
                                <asp:Label ID="lblSupplierNameLabel" runat="server" Text="Supplier Name"></asp:Label></td>
                            <td>
                                <asp:Label ID="lblSupplierName" runat="server"></asp:Label></td>
                        </tr>
                        <tr align="left">
                            <td class="auto-style1">
                                <asp:Label ID="lblAttn" runat="server" Text="Attn"></asp:Label></td>
                            <td>
                                <asp:DropDownList ID="ddlAttn" runat="server" CssClass="form-control"></asp:DropDownList></td>
                            <td>&nbsp;</td>
                        </tr>
                        <tr align="left">
                            <td class="auto-style1">
                                <asp:Label ID="lblExpectedDate" runat="server" Text="Expected Date"></asp:Label></td>
                            <td>
                                <asp:TextBox ID="txtExpectedDate" runat="server" Enabled="False" CssClass="form-control"></asp:TextBox>
                                </td>
                            <td>
                                <asp:ImageButton ID="ibtnExpectedDate" runat="server" Height="19px" ImageUrl="~/Images/calendar.jpg" Width="25px" OnClick="ibtnExpectedDate_Click" />
                                <asp:RequiredFieldValidator ID="rfvExpectedDate" runat="server" ErrorMessage="* Please select a date" ControlToValidate="txtExpectedDate" ForeColor="Red" ValidationGroup="SubmitGrp">*</asp:RequiredFieldValidator>
                                <asp:Label ID="lblDateError" runat="server" ForeColor="Red"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td class="auto-style1">&nbsp;</td>
                            <td>
                                <asp:Calendar ID="CalendarExpectedDate" runat="server" OnSelectionChanged="CalendarExpectedDate_SelectionChanged" Visible="False" Height="16px" Width="16px"></asp:Calendar>
                            </td>
                            <td>&nbsp;</td>
                        </tr>
                    </table>
                    <br />
                    <asp:GridView ID="gvPurchaseOrder" runat="server" AutoGenerateColumns="False" OnRowCancelingEdit="gvPurchaseOrder_RowCancelingEdit" OnRowDeleting="gvPurchaseOrder_RowDeleting" OnRowEditing="gvPurchaseOrder_RowEditing" OnRowUpdating="gvPurchaseOrder_RowUpdating" CssClass="table table-hover table-striped table-bordered" Width="70%">
                        <Columns>
                            <asp:TemplateField HeaderText="TempPO ID" Visible="False">
                                <ItemTemplate>
                                    <asp:Label ID="lblTempPOId" runat="server" Text='<%# Eval("TempPOId") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Item Name">
                                <ItemTemplate>
                                    <asp:Label ID="lblItemName" runat="server" Text='<%# Eval("ItemName") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Unit Of Measurement">
                                <ItemTemplate>
                                    <asp:Label ID="lblUOM" runat="server" Text='<%# Eval("UnitOfMeasurement") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Quantity">
                                <ItemTemplate>
                                    <asp:Label ID="lblQuantity" runat="server" Text='<%# Eval("Quantity") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtQuantity" runat="server" Text='<%# Bind("Quantity") %>'></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="rfvQuantity" runat="server" ErrorMessage="* Please enter a value" ForeColor="Red" ValidationGroup="UpdateGrp" ControlToValidate="txtQuantity">*</asp:RequiredFieldValidator>
                                    <asp:RangeValidator ID="rgvQuantity" runat="server" ErrorMessage="* Value must be at least 1" ForeColor="Red" ValidationGroup="UpdateGrp" MinimumValue="1" MaximumValue="2147483647" ControlToValidate="txtQuantity" Type="Integer">*</asp:RangeValidator>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Unit Price (S$)">
                                <ItemTemplate>
                                    <asp:Label ID="lblUnitPrice" runat="server" Text='<%# Eval("UnitPrice") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Amount (S$)">
                                <ItemTemplate>
                                    <asp:Label ID="lblAmount" runat="server" Text='<%# Eval("Amount") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:CommandField HeaderText="Edit" ShowEditButton="True" ShowHeader="True" ValidationGroup="UpdateGrp" />
                            <asp:CommandField HeaderText="Delete" ShowDeleteButton="True" ShowHeader="True" />
                        </Columns>
                    </asp:GridView>
                    <br />
                    <asp:Label ID="lblTotal" runat="server"></asp:Label>
                    <br />
                    <br />
                    <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" ValidationGroup="SubmitGrp" CssClass="btn-primary" />
                    <br />
                    <br />
                    <br />
                    <asp:Button ID="btnReturnToList" runat="server" Text="Return To Raise Purchase Order List" OnClick="btnReturnToList_Click" CssClass="btn" />
                    <br />
                    <br />
                    <asp:Button ID="btnSelectMore" runat="server" Text="Select More Items for Purchasing" OnClick="btnSelectMore_Click" CssClass="btn" />
                </ContentTemplate>
            </asp:UpdatePanel>
            <br />
            <br />
        </div>
</asp:Content>